package com.aegean.MonitorExamSYS.android.action;

import java.util.List;

import javax.annotation.Resource;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.aegean.MonitorExamSYS.monitor.business.MonitorBusiness;
import com.aegean.MonitorExamSYS.monitor.component.ExamineeState;
import com.opensymphony.xwork2.ActionSupport;
@Controller("ShowPositionInfosForAndroid")
@Scope("prototype")
public class ShowPositionInfosForAndroid extends ActionSupport{
	@Resource
	MonitorBusiness business;
	private int position_Id;
	private List<ExamineeState> examinees;
	private int totalCount;
	public int getPosition_Id() {
		return position_Id;
	}
	public void setPosition_Id(int position_Id) {
		this.position_Id = position_Id;
	}
	public List<ExamineeState> getExaminees() {
		return examinees;
	}
	public void setExaminees(List<ExamineeState> examinees) {
		this.examinees = examinees;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		String root = ServletActionContext.getServletContext().getRealPath(
				"/temp");
		String position = ServletActionContext.getServletContext().getRealPath(
				"/temp/" + position_Id);
		examinees = business
				.showExamineeOnPosition(position_Id, root, position);
		totalCount = examinees.size();
		return SUCCESS;
	}

}
